# 原始接口测试代码
import unittest

import requests


class TestMmtLogin(unittest.TestCase):
    # 获取图形验证码成功成功
    def setUp(self) -> None:
        url = "https://test-api-base.mmtwo.cn/captchas/8e20ddd0-ac16-11ed-9172-39cda48efa3c/LOGIN?rmd=1676357225721"
        requests.get(url)

    # 登陆成功
    def test02_login_ok(self):
        url = "https://test-api-seller.mmtwo.cn/seller/login"
        params = {"username": "food",
                  "password": "96e79218965eb72c92a549dd5a330112",
                  "scene": "LOGIN",
                  "captcha": 1111,
                  "uuid": "8e20ddd0-ac16-11ed-9172-39cda48efa3c"}
        resp = requests.get(url, params)
        print(resp.json())
        self.assertEqual(200, resp.status_code)

    # 登陆失败，密码错误
    def test03_login_false(self):
        url = "https://test-api-seller.mmtwo.cn/seller/login"
        params = {"username": "f1ood",
                  "password": "96e79218965eb72c92a549dd5a330112",
                  "scene": "LOGIN",
                  "captcha": 1111,
                  "uuid": "8e20ddd0-ac16-11ed-9172-39cda48efa3c"}
        resp = requests.get(url, params)
        print(resp.json())
        self.assertEqual(500, resp.status_code)
